package com.team.frame.utils;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * Created by lidan on 2017/1/20.
 */
public class Tools {

    /**
     * 读取Properties文件,根据Key读取Value
     * @param filePath
     * @param key
     * @return
     * @author lidan
     */
    public static String getValueByKey(String filePath, String key) {
        Properties pps = new Properties();
        try {
            InputStream in = new BufferedInputStream(new FileInputStream(filePath));
            pps.load(in);
            String value = pps.getProperty(key);
            System.out.println(key + " = " + value);
            return value;
        }catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }








}
